var a = require("../export.js");

Page({
    data: {
        bespeakList: {},
        isShowLoading: !1,
        hasMore: !0,
        is_load_more: !0,
        tabIndex: 0,
        datas: [],
        options: {},
        pageNumber: 1,
        limit: 4,
        daiqueren: 0,
        yiwancheng: 0,
        yuyuechenggong: 0,
        all: 0,
        cardInfo: !0,
        mycard: {},
        daodi: 0,
        ConfigInfo: []
    },
    onLoad: function(a) {
        this.init(a), this.countNum(a), this.getConfigInfo(a);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.asonPullDownRefresh();
    },
    asonPullDownRefresh: function() {
        this.setData({
            datas: [],
            pageNumber: 1,
            hasMore: !0,
            is_load_more: !0,
            daodi: 0
        });
        var t = {
            hasMore: this.data.hasMore,
            pageNumber: this.data.pageNumber,
            limit: this.data.limit,
            search: []
        };
        this.list(t), this.getConfigInfo(t), a.dg.stopPullDownRefresh();
    },
    onReachBottom: function() {},
    init: function(a) {
        a = {
            hasMore: this.data.hasMore,
            pageNumber: this.data.pageNumber,
            limit: this.data.limit,
            search: []
        }, this.list(a);
    },
    list: function(t) {
        var e = this;
        if (!t.hasMore) return this.setData({
            isShowLoading: !1
        }), !1;
        var n = {};
        n.type = this.data.tabIndex, n.pagesize = t.pageNumber, n.pagenum = t.limit, a.requestUtil.post(a._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/mybespeakList.html", n, function(n) {
            var o = e.data.bespeakList;
            0 != (n = n || []).length ? (0, a._)(n).map(function(a) {
                return e.setData({
                    daodi: 1
                }), a;
            }) : e.setData({
                daodi: 0
            }), o = 1 == t.pageNumber ? n || [] : o.concat(n || []), e.setData({
                isShowLoading: !1,
                hasMore: !(n.length < e.data.limit),
                pageNumber: t.pageNumber + 1,
                bespeakList: o
            });
        }, this, {
            isShowLoading: !1
        }), console.log(this.data);
    },
    allcard: function(a) {
        var t = parseInt(a.currentTarget.dataset.tabIndex);
        this.setData({
            tabIndex: t
        }), this.setData({
            is_load_more: !0,
            pageNumber: 1,
            datas: []
        }), this.countNum(this.data.options), this.onPullDownRefresh(1);
    },
    countNum: function(t) {
        var e = this;
        a.requestUtil.post(a._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/mybespeakCount.html", t, function(a) {
            e.setData({
                daiqueren: a.daiqueren,
                yiwancheng: a.yiwancheng,
                yuyuechenggong: a.yuyuechenggong,
                all: a.all
            });
        });
    },
    getConfigInfo: function(t) {
        var e = this;
        a.requestUtil.post(a._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/getConfigInfo.html", t, function(a) {
            e.setData({
                ConfigInfo: a
            });
        });
    },
    callPhone: function(a) {
        console.log(a);
        var t = a.currentTarget.dataset.mobile;
        wx.makePhoneCall({
            phoneNumber: t
        });
    }
});